home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The World of Computer Software
/
The World of Computer Software.iso
/
g_mouse.zip
/
DEMOMOUS.PAS
next >
Wrap
Pascal/Delphi Source File
|
1992-09-23
|
7KB
|
175 lines
Program Demo_Mouse;
Uses Crt,Dos,Graph,G_Mouse;
Var x, y, button, b: Word;
i:integer;
Condition:boolean;
Procedure Init;
Var GrD, GrM : Integer;
Begin
DetectGraph (GrD,GrM);
InitGraph (GrD,GrM,'c:\tp\bgi');
If Not TestMouse Then Begin
SetTextJustify (CenterText, CenterText);
SetTextStyle (DefaultFont, HorizDir, 5);
OutTextXY (Round (GetMaxX/2), Round (GetMaxY/2), 'You need a mouse driver !');
Repeat Until KeyPressed;
Halt;
End;
ChangeMouse(Arrow);
End;
Procedure Title;
Begin
SetTextStyle (1, HorizDir, 6);
SetTextJustify (CenterText, TopText);
OutTextXY (Round (GetMaxX/2), 5, 'UNIT MOUSE');
SetTextJustify (CenterText, BottomText);
OutTextXY (Round (GetMaxX/2), GetMaxY-5, 'DEMO');
End;
Begin
Init;
SetColor (13);
Title;
SetTextJustify (LeftText, CenterText);
SetTextStyle(1, HorizDir, 3);
SetColor (15);
OutTextXY (Round (GetMaxX/15), Round (GetMaxY/20*4), 'This unit allows you to show or hide');
OutTextXY (Round (GetMaxX/15), Round (GetMaxY/20*5), 'the mouse. This is usefull when you draw');
OutTextXY (Round (GetMaxX/15), Round (GetMaxY/20*6), 'on the background...');
Box (Round (GetMaxX/2), Round (GetMaxY/2), GetMaxX, 30,0,0,2,'Click to hide the mouse');
Show_Mouse;
Repeat MouseState (x,y,button) Until button<>0;
Hide_Mouse;
Repeat MouseState (x,y,button) Until button=0;
Box (Round (GetMaxX/2), Round (GetMaxY/2), GetMaxX, 30,0,0,2,'Click to show the mouse');
Repeat MouseState (x,y,button) Until button<>0;
Box (Round (GetMaxX/2), Round (GetMaxY/20*15), 120, 30,9,3,1,'Continue');
Show_Mouse;
WaitBox (Round (GetMaxX/2)-60,Round (GetMaxY/20*15)-15,Round (GetMaxX/2)+60,Round (GetMaxY/20*15)+15,Left);
Hide_Mouse;
ClearViewPort;
SetColor (11);
Title;
SetTextJustify (LeftText, CenterText);
SetTextStyle(1, HorizDir, 3);
SetColor (15);
OutTextXY (Round (GetMaxX/15), Round (GetMaxY/20*4), 'This unit allows you to create easily selection');
OutTextXY (Round (GetMaxX/15), Round (GetMaxY/20*5), 'boxes, and wait the user click one of them...');
OutTextXY (Round (GetMaxX/15), Round (GetMaxY/20*6), 'with the button you want...');
Box (Round (GetMaxX/4), Round (GetMaxY/2), 120, 30,10,2,1,'Left');
If KindOfMouse=3 Then
Box (Round (GetMaxX/2), Round (GetMaxY/2), 120, 30,10,2,1,'Center');
Box (Round (GetMaxX/4*3), Round (GetMaxY/2), 120, 30,10,2,1,'Right');
Box (Round (GetMaxX/2), Round (GetMaxY/20*15), 120, 30, 9, 3, 1,'Continue');
SetTextJustify (LeftText, CenterText);
SetTextStyle(1, HorizDir, 3);
SetColor (12);
OutTextXY (Round (GetMaxX/15), Round (GetMaxY/20*12), 'Try at it on each of those boxes...');
Show_Mouse;
Repeat
MouseState (x,y,button);
If (((y>Round(GetMaxY/2)-15) And (y<Round (GetMaxY/2)+15)) And
(((x>Round (GetMaxX/4)-60) And (x<Round (GetMaxX/4)+60) And (button=Left)) Or
((x>Round (GetMaxX/2)-60) And (x<Round (GetMaxX/2)+60) And (KindOfMouse=3) And (button=Middle)) Or
((x>Round (GetMaxX/4*3)-60) And (x<Round (GetMaxX/4*3)+60) And (button=Right)))) Then Begin
Sound (1000);
Delay (100);
NoSound;
End;
Until Testbutton(Round (GetMaxX/2)-60,Round(GetMaxY/20*15)-15,Round (GetMaxX/2)+60,Round (GetMaxY/20*15)+15,Left);
Hide_Mouse;
ClearViewPort;
SetColor (12);
Title;
SetTextJustify (LeftText, CenterText);
SetTextStyle(1, HorizDir, 3);
SetColor (15);
OutTextXY (Round (GetMaxX/15), Round (GetMaxY/20*4), 'This unit allows you to change the mouse cursor');
OutTextXY (Round (GetMaxX/15), Round (GetMaxY/20*5), 'There are 4 predefined cursors in constants and');
OutTextXY (Round (GetMaxX/15), Round (GetMaxY/20*6), 'you can define new cursor...in an easy way...');
SetColor(2);
SetTextJustify (CenterText, CenterText);
OutTextXY (Round (GetMaxX/2), Round (GetMaxY/2), 'Click right button to change the cursor');
Box (Round(GetMaxX/2),Round(GetMaxY/20*15),120,30,9,3,1,'Continue');
Show_Mouse;
i:=0;
Condition:=False;
Repeat
Waitbutton(x,y,button);
Case button Of
Left : If ((x>(Round(GetMaxX/2)-60)) And (x<(Round(GetMaxX/2)+60))) And
((y>(Round(GetMaxY/20*15)-15)) And (y<(Round(GetMaxY/20*15)+15))) Then
Condition:=True;
Right : Begin
Inc (i);
i:= i Mod 4;
Case i Of
0 : ChangeMouse (Arrow);
1 : ChangeMouse (Target);
2 : ChangeMouse (Bomb);
3 : ChangeMouse (QuestionMark);
End;
End;
End;
Until Condition;
Hide_Mouse;
ClearViewPort;
SetColor (9);
Title;
SetTextJustify (LeftText, CenterText);
SetTextStyle(1, HorizDir, 3);
SetColor (15);
OutTextXY (Round (GetMaxX/15), Round (GetMaxY/20*4), 'This unit allows you to define a area out of');
OutTextXY (Round (GetMaxX/15), Round (GetMaxY/20*5), 'which the mouse can''t go...');
Show_Mouse;
PutMouse(0,0);
MouseLimits (Round(GetMaxX/2)-150,Round(GetMaxY/2)-50,Round(GetMaxX/2)+150,Round(GetMaxY/2)+50);
b:=0;
Repeat
Hide_Mouse;
Box (Round(GetmaxX/2), Round(GetMaxY/2),300,100,14,8,2,'Limited area');
Show_Mouse;
For i:=0 To 10000 Do Begin
MouseState (x,y,Button);
If button<>0 Then b:=button;
End;
Hide_Mouse;
Box (Round(GetmaxX/2), Round(GetMaxY/2),300,100,14,8,2,'Click To Continue');
Show_Mouse;
For i:=0 To 10000 Do Begin
MouseState (x,y,Button);
If button<>0 Then b:=button;
End;
Until b<>0;
Hide_Mouse;
ClearViewPort;
SetColor (10);
Title;
SetTextJustify (CenterText, CenterText);
SetTextStyle(1, HorizDir, 3);
SetColor (15);
OutTextXY (Round (GetMaxX/2), Round (GetMaxY/20*6), 'All in all, you''ll find 12 procedures, 2 functions,');
OutTextXY (Round (GetMaxX/2), Round (GetMaxY/20*7), 'few constants and types in the unit G_MOUSE.TPU');
OutTextXY (Round (GetMaxX/2), Round (GetMaxY/20*8), 'All details are in the file USER.TXT.');
OutTextXY (Round (GetMaxX/2), Round (GetMaxY/20*9), 'I wish you a lot of fun and nice new graphic');
OutTextXY (Round (GetMaxX/2), Round (GetMaxY/20*10), 'programs with your MOUSE...!');
UnLimitMouse;
Show_Mouse;
Repeat
x:=Random (GetMaxX);
y:=Random (GetMaxY);
PutMouse (x,y);
Delay (100);
MouseState (x,y,button);
Until button<>0;
Hide_Mouse;
ClearViewPort;
End.